package io.openmessaging;

import com.sun.deploy.util.StringUtils;
import com.sun.tools.javac.util.ArrayUtils;

import java.util.*;

public class 最大顺讯 {


    public static void main(String[] args) {
                int[] nums=new int[]{3,30,34,5,9};
                Arrays.sort(nums);
                String[] dp=new String[nums.length];
                dp[0]=String.valueOf(nums[0]);
                for(int i=1;i<nums.length;i++){
                    String a=String.valueOf(dp[i-1])+String.valueOf(nums[i]);
                    String b=String.valueOf(nums[i])+String.valueOf(dp[i-1]);
                    dp[i]=(a.compareTo(b)>0?a:b);
                }
                System.out.println(dp[nums.length-1]);
            }
}
